- Complaint Management System.cpp
- project /
1 //-------------------------------------------------------
2 //Project -- Complaint Management System (Travel Agency)
3 //-------------------------------------------------------
4
5 //-------------------------------------------------------
6 // Developer: Md. Saifuddin Tipu
7 //-------------------------------------------------------
8 // Administrator Password to Login
9 //-------------------------------------------------------
10 /*
11 username == user
12 password == pass
13 */
14
15 //Standard Library
16
17 #include <iostream>
18 #include <stdlib.h>
19 #include <string>
20 #include <cctype>
21 #include <fstream>
22
23 using namespace std;
24
25 class complaint //base class
26 {
27 public:
28 void customer_StoreComplaint();
29 void admin_menu();
30 void create_complaint();
31 void cancel_complaint();
32 void update_complaint ();
33 void print_complaint();
34 void view_complaint();
35 void exit();
36
37 complaint();//constuctor
38
39 };
40
41 complaint::complaint ()
42 {
43
44 } //constructor for class CarType
45
46
47 struct node //construct node
48 {
49 int complaint_number;
50 string customerName;
51 string date;
52 string x;
53
54 node *prev;
55 node *next;
56 node *link;
57
58 }*q, *temp; //pointer declaration
59
60
61 node *start_ptr = NULL;
62 node *head = NULL;
63 node *last = NULL;
64
65 int main() // Main function
66 {
67 complaint admin;
68 system("COLOR 79"); //Color to change background
69 int option;
70 do
71 {
72 cout<<"\n";
73 cout<<"\t\t ================================================\n";
74 cout<<"\t\t| Complaint Management System - TRAVEL AGENCY |\n";
75 cout<<"\t\t ================================================\n\n\n";
76
77 cout<<"\t\t-------------------------------------------------\n";
78 cout<<"\t\t|\t1. Customer \t\t\t\t|\n";
79 cout<<"\t\t-------------------------------------------------\n";
80 cout<<"\t\t-------------------------------------------------\n";
81 cout<<"\t\t|\t2. Administrator \t\t\t|\n";
82 cout<<"\t\t-------------------------------------------------\n";
83 cout<<"\t\t-------------------------------------------------\n";
84 cout<<"\t\t|\t3. EXIT \t\t\t\t|\n";
85 cout<<"\t\t-------------------------------------------------\n\n";
86
87 cout<<"\t\tInput number Associated with Your User Type: ";
88 cin>>option;
89 switch(option)
90 {
91 case 1:
92 admin.customer_StoreComplaint();
93 break;
94 case 2:
95 admin.admin_menu();
96 break;
97 case 3:
98 admin.exit(); //function exit
99 goto a;
100 break;
101 }
102
103 }while(option!=3);//end do
104 a://goto
105 cout<<"thank you"<<endl;
106 system ("PAUSE");
107
108 }//end main function
109
110 void complaint::customer_StoreComplaint()
111 {
112 system("cls");
113 cout<<"\n";
114 cout<<"\t\t ================================================\n";
115 cout<<"\t\t| Complaint Management System - TRAVEL AGENCY |\n";
116 cout<<"\t\t ================================================\n\n\n";
117 cout <<"\nAdd Your Complaint Details\n";
118 cout <<"________________________________\n\n";
119
120 node *temp;
121 temp = new node;
122 cout << "Type Complaint no: ";
123 cin >> temp->complaint_number;
124 cout<< "Enter Your Name: ";
125 cin.ignore();
126 getline(cin, temp->customerName);
127 cout<<"Enter Date : ";
128 cin>>temp->date;
129 cout << "Complaint Description:";
130 cout<<"( 1000 words maximum ) \n";
131 cin.ignore();
132 getline(cin, temp->x);
133
134 cout<<"==========================================================================="<<endl;
135 cout << "Complaint added Successfully"<<endl;
136 cout<<"==========================================================================="<<endl;
137
138 system ("PAUSE");
139
140 temp->next=NULL;
141 if(start_ptr!=NULL)
142 {
143 temp->next=start_ptr;
144 }
145 start_ptr=temp;
146 system("cls");
147 }
148
149 void complaint::admin_menu()
150 {
151 complaint admin;
152 int menu;
153 string userName, userPassword;
154
155 system("cls");
156 cout<<"\n";
157 cout<<"\t\t ===================================================\n";
158 cout<<"\t\t| Complaint Management System - TRAVEL AGENCY |\n";
159 cout<<"\t\t ===================================================\n\n\n";
160 cout<<"\t\t----------------------------------------------------\n";
161 cout<<"\t\t\t Administrator / Staff Login \n";
162 cout<<"\t\t----------------------------------------------------\n\n";
163 cout << "\n\n\t\tPlease enter your user name: ";
164 cin >> userName;
165 cout << "\n\n\t\tPlease enter your user password: ";
166 cin >> userPassword;
167
168 if (userName == "user" && userPassword == "pass")
169 {
170 do
171 {
172 system("cls");
173 cout<<"\n";
174 cout<<"\t\t ===================================================\n";
175 cout<<"\t\t| Complaint Management System - TRAVEL AGENCY |\n";
176 cout<<"\t\t ===================================================\n\n\n";
177 cout<<"\t\t--------------------------------------------------\n";
178 cout<<"\t\t||\t1. Create a Complaint \t\t\t ||\n";
179 cout<<"\t\t||\t2. View Complaint\t\t\t ||\n";
180 cout<<"\t\t||\t3. Update Complaint Status \t\t ||\n";
181 cout<<"\t\t||\t4. Print the complaint \t\t\t ||\n";
182 cout<<"\t\t||\t5. Cancel a Complaint \t\t\t ||\n";
183 cout<<"\t\t||\t6. Logout\t\t\t\t ||\n";
184 cout<<"\t\t--------------------------------------------------\n";
185 cout<<"Enter choice: ";
186 //---Brought To You By code-projects.org---
187 cin>>menu;
188
189 switch (menu)
190 {
191 case 1:
192 {
193 admin.create_complaint();
194 break;
195 }
196
197
198 case 2:
199 {
200 admin.view_complaint();
201 system("PAUSE");
202 break;
203 }
204
205 case 3:
206 {
207 admin.update_complaint();
208 system("PAUSE");
209 break;
210 }
211
212 case 4:
213 {
214 admin.print_complaint();
215 system("PAUSE");
216 break;
217 }
218 case 5:
219 {
220 admin.cancel_complaint();
221 system("PAUSE");
222 break;
223 }
224 case 6:
225 {
226 cout<<"You are Logged Out...!\n\n\n\n";
227 system ("PAUSE");
228 admin.admin_menu();
229 break;
230 }
231
232 }//end Switch
233
234 }while(menu!=6);//end do
235 cout<<"thank you"<<endl;
236 system ("PAUSE");
237 }
238
239 else
240 {
241 cout << "\n\n\t\tInvalid login attempt. Please try again.\n" << '\n';
242 system("PAUSE");
243 system ("cls");
244 admin.admin_menu();
245
246
247 }
248 }
249
250 void complaint::create_complaint()
251 {
252 system("cls");
253 cout<<"\n";
254 cout<<"\t\t ================================================\n";
255 cout<<"\t\t| Complaint Management System - TRAVEL AGENCY |\n";
256 cout<<"\t\t ================================================\n\n\n";
257 cout <<"\nAdd Complaint Details of Customer\n";
258 cout <<"_____________________________________ \n\n";
259
260 node *temp;
261 temp = new node;
262 cout << "Type Complaint no: ";
263 cin >> temp->complaint_number;
264 cout<< "Enter Customer Name: ";
265 cin.ignore();
266 getline(cin, temp->customerName);
267 cout<<"Enter Date : ";
268 cin>>temp->date;
269 cout << "Complaint Description:";
270 cout<<"( 1000 words maximum ) \n";
271 cin.ignore();
272 getline(cin, temp->x);
273
274 cout<<"==========================================================================="<<endl;
275 cout << "Complaint added Successfully"<<endl;
276 cout<<"==========================================================================="<<endl;
277 cout << "Go to Print Complaint to print the Complaint"<<endl;
278 cout<<"==========================================================================="<<endl;
279 system ("PAUSE");
280
281 temp->next=NULL;
282 if(start_ptr!=NULL)
283 {
284 temp->next=start_ptr;
285 }
286 start_ptr=temp;
287 system("cls");
288 }
289
290
291 void complaint::view_complaint()
292 {
293 int num;
294 bool found; //variable to search
295 system("cls");
296 node *temp;
297
298 temp=start_ptr;
299 found = false;
300 cout<<"\n";
301 cout<<"\t\t ================================================\n";
302 cout<<"\t\t| Complaint Management System - TRAVEL AGENCY |\n";
303 cout<<"\t\t ================================================\n\n\n";
304 cout<<" Enter the Complaint Number To Look into The Complaint Details\n";
305 cin>>num;
306 cout<<"\n";
307 cout<<"---------------------------------------------------------------------------"<<endl;
308 cout <<"\t\tHere is the Complaint list\n";
309 cout<<"---------------------------------------------------------------------------"<<endl;
310
311
312 if(temp == NULL)
313 {
314 cout << "\tThere is no Complaint to show\n\t\t\tSo The List is Empty\n\n\n";
315 }
316 while(temp !=NULL && !found)
317 {
318 if (temp->complaint_number==num)
319 {
320 found = true;
321 }
322 else
323 {
324 temp = temp -> next;
325 }
326 if (found)
327 {
328 cout <<"Complaint Number : "<<temp->complaint_number;
329 cout <<"\n";
330 cout<<"Customer Name: "<<temp->customerName<<endl;
331
332 cout<<"Complain Date : "<<temp->date<<endl;
333
334 cout<<"_____________________________________________________________________________"<<endl;
335 cout<<"-------------------------"<<endl;
336 cout<<"|Complaint description: |"<<endl;
337 cout<<"-------------------------"<<endl;
338 cout<<temp->x;
339
340 cout <<"\n";
341 cout<<"_____________________________________________________________________________"<<endl;
342
343 }
344
345
346 }
347 }
348
349
350 void complaint::cancel_complaint()
351 {
352 system("cls");
353 int num, count;
354 cout<<"\n";
355 cout<<"\t\t ================================================\n";
356 cout<<"\t\t| Complaint Management System - TRAVEL AGENCY |\n";
357 cout<<"\t\t ================================================\n\n\n";
358 cout<<"Enter the Complaint number you want to delete \n";
359 cin>>num;
360 node *q;
361 node *temp;
362 bool found;
363
364 if(start_ptr == NULL)
365 cerr<<"Can not cancel from an empty list.\n";
366 else
367 {
368 if(start_ptr->complaint_number == num)
369 {
370 q = start_ptr;
371 start_ptr = start_ptr->next;
372 count--;
373 if(start_ptr == NULL)
374 last = NULL;
375 delete q;
376 cout<<"The Complaint is Cancelled Successfully"<<endl;
377 }
378 else
379 {
380 found = false;
381 temp = start_ptr;
382 q = start_ptr->next;
383
384 while((!found) && (q != NULL))
385 {
386 if(q->complaint_number != num)
387 {
388 temp = q;
389 q = q-> next;
390 }
391 else
392 found = true;
393 }
394
395 if(found)
396 {
397 temp->next = q->next;
398 count--;
399
400 if(last == q)
401 last = temp;
402 delete q;
403 cout<<"The Complaint is Cancelled Successfully"<<endl;
404 }
405 else
406 cout<<"Complaint to be Cancelled is not in the list."<<endl;
407 }
408 }
409 } //End function
410
411 void complaint::update_complaint()
412 {
413 system("cls");
414 int sid;
415 bool found;
416 found = false;
417 temp = start_ptr;
418 cout<<"\n";
419 cout<<"\t\t ================================================\n";
420 cout<<"\t\t| Complaint Management System - TRAVEL AGENCY |\n";
421 cout<<"\t\t ================================================\n\n\n";
422 cout<<"Enter Complaint Number To Update: ";
423 cin>>sid;
424 if (temp==NULL && sid==0)
425 {
426 cout<<"No Complaint To Update..!"<<endl;
427 }
428
429 else
430 {
431 while(temp !=NULL && !found)
432 {
433 if (temp->complaint_number==sid)
434 {
435 found = true;
436 }
437 else
438 {
439 temp = temp -> next;
440 }
441 if (found)
442 {
443 cout << "Change Complaint Number: ";
444 cin >> temp->complaint_number;
445 cout<< "Change Customer Name: ";
446 cin.ignore();
447 getline(cin, temp->customerName);
448 cout<<"Change Date : ";
449 cin>>temp->date;
450 cout << "Complaint Description:"<< endl;
451 cout<<"( 1000 words maximum ) \n";
452 cout << " " ;
453 cin.ignore();
454 getline(cin, temp->x);
455
456 system("PAUSE");
457 temp = temp->next;
458
459
460 }
461
462 cout<<"COMPLAINT RECORD UPDATED....!\n\n"<<endl;
463 }
464
465 if(temp != NULL && temp->complaint_number != sid)
466 {
467 cout<<"Invalid Complaint Number...!\n\n"<<endl;
468 }
469
470 }
471
472 } //End function
473
474 void complaint::print_complaint()
475 {
476 int num;
477 bool found; //variable to search
478 system("cls");
479 ofstream outputFile;
480 outputFile.open("prototype.txt");
481 node *temp;
482
483 temp=start_ptr;
484 found = false;
485 cout<<"\n";
486 cout<<"\t\t ================================================\n";
487 cout<<"\t\t| Complaint Management System - TRAVEL AGENCY |\n";
488 cout<<"\t\t ================================================\n\n\n";
489 outputFile<<"\n";
490 outputFile<<"\t\t ================================================\n";
491 outputFile<<"\t\t| Complaint Management System - TRAVEL AGENCY |\n";
492 outputFile<<"\t\t ================================================\n\n\n";
493 cout<<" Enter the Complaint Number To Print The Complaint Details\n";
494 cin>>num;
495 cout<<"\n";
496 cout<<"---------------------------------------------------------------------------"<<endl;
497 cout <<"\t\tHere is the Complaint list\n";
498 cout<<"---------------------------------------------------------------------------"<<endl;
499
500
501 if(temp == NULL)
502 {
503 cout << "\tThere is no Complaint to show\n\t\t\tSo The List is Empty\n\n\n";
504 }
505 while(temp !=NULL && !found)
506 {
507 if (temp->complaint_number==num)
508 {
509 found = true;
510 }
511 else
512 {
513 temp = temp -> next;
514 }
515 if (found) //print the complaint
516 {
517 cout <<"Complaint Number : "<<temp->complaint_number;
518 outputFile << "Complaint Number : "<<temp->complaint_number << endl;
519 cout <<"\n";
520 cout<<"Customer Name: "<<temp->customerName<<endl;
521 outputFile << "Customer Name: "<<temp->customerName<<endl;
522 cout<<"Order Date : "<<temp->date<<endl;
523 outputFile << "Order Date : "<<temp->date<<endl;
524 cout<<"____________________________________________________________________________"<<endl;
525 outputFile << "____________________________________________________________________________"<<endl;
526 cout<<"Complaint description: "<<endl;
527 outputFile << "Complaint description: "<<endl;
528 cout<<"----------------------"<<endl;
529 outputFile<<"------------------------------------------------------------------------------"<<endl;
530 cout<< temp->x;
531 outputFile << temp->x<<endl;
532 cout <<"\n";
533 cout<<"____________________________________________________________________________"<<endl;
534 outputFile << "____________________________________________________________________________"<<endl;
535
536 temp=temp->next;
537
538 }
539 outputFile.close();
540 cout << "Complaint Printed Succesfully....!\n";
541
542 }
543 } //End function
544
545 void complaint::exit() //Function to exit
546 {
547 cout<<"\nYou choose to exit.\n"<<endl;
548 } //end function exit
549
550
551 ////////////////////////////THE END OF PROGRAM//////////////////////////////////////////